<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

class CreateAdsTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('ads', function (Blueprint $table) {
            $table->increments('id')->comment('自增ID');
            $table->unsignedInteger('space_id')->default('0')->comment('广告位表ID');
            $table->string('name', 50)->default('')->comment('广告名称');
            $table->unsignedInteger('cover_image')->default('0')->comment('广告图，附件表ID');
            $table->string('href', 100)->default('')->comment('链接地址');
            $table->string('href_target', 20)->default('')->comment('打开方式');
            $table->string('rel', 20)->comment('链接关系XFN，数据来源数据字典');
            $table->string('partner', 50)->default('')->comment('客户名称');
            $table->string('partner_linkman', 20)->default('')->comment('联系人');
            $table->string('partner_phone_number', 20)->default('')->comment('联系电话');
            $table->string('description', 200)->default('')->comment('备注');
            $table->unsignedTinyInteger('cast_period')->default('0')->comment('投放周期：1永久，2时间范围；数据字典');
            $table->timestamp('start_time')->nullable()->comment('开始时间');
            $table->timestamp('end_time')->nullable()->comment('结束时间');
            $table->unsignedInteger('sort')->default('999')->comment('排序位置');
            $table->tinyInteger('status')->default(1)->comment('发布状态，0未发布，1已发布 ，数据字典');
            $table->unsignedInteger('created_user_id')->default('0')->comment('管理员ID');
            $table->timestamp('created_at')->nullable()->comment('创建时间');
            $table->timestamp('updated_at')->nullable()->comment('更新时间');
            $table->softDeletes()->comment('删除时间');
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('ads');
    }
}
